package org.rpgmapper.bo;

import java.util.ArrayList;
import java.util.List;
import org.rpgmapper.bo.rules.Rule;
import org.rpgmapper.skirmish.OnBonusEndListener;

public class Bonus {

    private String effect;
    private List<Rule> ruleSet = new ArrayList<Rule>();
    private int duration;
    private int currentDuration;
    private BonusType type;
    private OnBonusEndListener onBonusEndListener;

    public Bonus(int duration, String effect, BonusType type) {
        this.duration = this.currentDuration = duration;
        this.effect = effect;
        this.type = type;
    }

    public void decDuration() {
        currentDuration--;
        if (currentDuration == 0) {
            if (this.onBonusEndListener != null) {
                this.onBonusEndListener.onBonusEnd(this);
            }
        }
    }

    public BonusType getType() {
        return type;
    }

    public void setType(BonusType type) {
        this.type = type;
    }

    public String getEffect() {
        return effect;
    }

    public void setEffect(String effect) {
        this.effect = effect;
    }

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public int getDurationBeforeEnd() {
        return currentDuration;
    }

    public OnBonusEndListener getOnBonusEndListener() {
        return onBonusEndListener;
    }

    public void setOnBonusEndListener(OnBonusEndListener onBonusEndListener) {
        this.onBonusEndListener = onBonusEndListener;
    }

    public List<Rule> getRuleSet() {
        return ruleSet;
    }
    
    
}
